package com.meida.module.bus.client.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.NoArgsConstructor;

/**
 * 用户类型
 *
 * @author gp
 * @date 2021/8/9
 */
@NoArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@ApiModel("用户类型")
public enum UserTypeEnum {
    /**
     * 用户类型
     */
    USER("USER", "普通用户"),
    SCHOLARTYRANT("SCHOLARTYRANT", "学霸");

    @EnumValue
    private String value;
    private String label;

    UserTypeEnum(String value, String label) {
        this.value = value;
        this.label = label;
    }


    public void setValue(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public static UserTypeEnum getByValue(String value) {
        for (UserTypeEnum userTypeEnum : values()) {
            if (userTypeEnum.getValue().equals(value)) {
                return userTypeEnum;
            }
        }
        return null;
    }

}
